<template>
  <div class="about">
    <el-card style="margin: 10px;" v-loading="loading">
      <div slot="header" style="text-align: left">
        <span>{{ user.nickName }}</span>
      </div>
      <div>
        <div>
          <img
            :src="user.userFace"
            :alt="user.nickname"
            style="width: 70px;height: 70px"
          />
        </div>
        <div
          style="text-align: left;color:#20a0ff;font-size: 12px;margin-top: 13px"
        >
          <span>用户名:</span><span>{{ user.username }}</span>
        </div>
        <div
          style="text-align: left;color:#20a0ff;font-size: 12px;margin-top: 13px"
        >
          <span>电子邮箱:</span><span>{{ user.email }}</span>
        </div>
        <div
          style="text-align: left;color:#20a0ff;font-size: 12px;margin-top: 13px"
        >
          <span>手机号:</span><span>{{ user.mobile }}</span>
        </div>
        <div
          style="text-align: left;color:#20a0ff;font-size: 12px;margin-top: 13px"
        >
          <span>注册时间:</span><span>{{ user.createTime }}</span>
        </div>

        <div
          style="text-align: left;color:#20a0ff;font-size: 12px;margin-top: 13px"
        >
          <span>用户角色:</span>
          <el-tag
            v-for="role in user.roles"
            :key="role.id"
            size="mini"
            style="margin-right: 8px"
            type="success"
          >
            {{ role.zhName }}
          </el-tag>
        </div>
      </div>
    </el-card>
  </div>
</template>
<script>
import { get } from "../utils/api";
export default {
  data() {
    return {
      user: {},
      userInfo: {}
    };
  },
  mounted() {
    this.userInfo = JSON.parse(localStorage.getItem("userInfo"));
    this.getUserInfo();
  },
  methods: {
    getUserInfo() {
      this.loading = true;
      get("/admin/user/" + this.userInfo.id).then(resp => {
        if (resp.code == 0) {
          this.user = resp.data;
        } else {
          this.$message({ type: "error", message: "数据加载失败!" });
        }
        this.loading = false;
      });
    }
  }
};
</script>

<style></style>
